<?php
class X2ClientScript extends CClientScript {
	/**
	 * Inserts the scripts at the beginning of the body section.
	 * @param boolean $includeScriptFiles whether to include external files, or just dynamic scripts
	 * @return string the output to be inserted with scripts.
	 */
	public function renderOnRequest($includeScriptFiles = false) {
		$html='';
		if($includeScriptFiles) {
			foreach($this->scriptFiles as $scriptFiles) {
				foreach($scriptFiles as $scriptFile)
					$html.=CHtml::scriptFile($scriptFile)."\n";
			}
		}
		foreach($this->scripts as $script)	// the good stuff!
			$html.=CHtml::script(implode("\n",$script))."\n";

		if($html!=='')
			return $html;
	}
}